//存储
var Store = function(key){
    this.key = 'mt-'+ key;
}
Store.prototype = {
    get: function(){
        var data = window.localStorage.getItem(this.key);
        return data ? JSON.parse(data) : null;
    },

    set: function(data){
        var data = JSON.stringify(data)
        window.localStorage.setItem(this.key, data);
    },
    add: function(saveData){
        var newData = [];
        var data = this.get(this.key) || [];

        if(data instanceof Array){
            if(saveData instanceof Array){
                newData = data.concat(saveData);
                this.set(this.key, newData);
            }else{
                data.push(saveData);
                this.set(this.key, data);
            }
        }
    },
    clear: function(){
        this.set(this.key, '');
    }
}